#!/usr/bin/ENV perl -w

use Spreadsheet::Read;
use Spreadsheet::XLSX;
use Excel::Writer::XLSX;
use Encode 'decode';
use utf8;
#use Data::Dump qw(dump);



#read a xlsx file;
my $xlsx = ReadData "test.xlsx";

my $xlsx_maxcol = $xlsx->[1]{maxcol};
my $xlsx_maxrow = $xlsx->[1]{maxrow};

#warn dump $xlsx;
#print $xlsx->[1]{cell}[$xlsx_maxcol][$xlsx_maxrow];
#print decode('utf8', $xlsx->[1]{E1});

#write a xlsx file
my $write_xlsx = Excel::Writer::XLSX->new( 'test2.xlsx' );
my $worksheet = $write_xlsx->add_worksheet();

for (my $row = 0; $row < $xlsx_maxrow; $row++){
	for (my $col = 0; $col < $xlsx_maxcol; $col++){
		$xlsex_utf8 = decode('utf8', $xlsx->[1]{cell}[$col+1][$row+1]);
		$worksheet->write( $row, $col, $xlsex_utf8);
	}
}
#$worksheet->write( 65537, 2, "1.1111111111111111111111111111111111111111111111111111111111111111111111111" x 10000);